fix: skip retries for HTTP 429 error 1113#76
Open
z116123123x wants to merge 1 commit into
Open
Conversation
z116123123x
marked this pull request as ready for review
July 14, 2026 07:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Z.AI returns HTTP 429 for both retryable throttling conditions and business
errors. The SDK currently retries every HTTP 429 response, so business error
1113(account in arrears; recharge required) causes repeated requests eventhough it requires an account-state change to recover.
This change:
error.code;1113;x-should-retryoverrides;1305, retryable;APIReachLimitErrorstill contains the response body.For SDK users, error
1113now raises the existingAPIReachLimitErrorimmediately instead of waiting through automatic retries. There is no public
API change.
Reference: Z.AI error codes
Verification
make test: 68/68 passed locally with Poetry 1.8.2 on Python 3.9,3.10, 3.11, and 3.12
git diff --checkpassedThe full Python 3.8 suite was not completed locally because the locked DuckDB
dependency fell back to a long source build on macOS arm64. The targeted Python
3.8 tests pass, and the repository's Ubuntu CI will run the full Python 3.8
job.
Checklist
CONTRIBUTINGguidemake testbecause this changes internal retry classification without changing the
public API